<h1>Listing patients</h1>

<%= link_to 'New Patient', new_patient_path %> | <%= link_to 'Back to Appointments List', appointments_path %></br> 
<table border="1">
  <thead>
    <tr>
      <th>Full name</th>
      <th>Dob</th>
      <th>Mobile</th>
      <th>Email</th>
      <th>Address</th>
    </tr>
  </thead>

  <tbody>
    <% @patients.each do |patient| %>
      <tr>
        <td><%= link_to patient.full_name , patient %></td>
        <td><%= patient.dob %></td>
        <td><%= patient.mobile %></td>
        <td><%= patient.email %></td>
        <td><%= patient.contacts.map {|c| c.address}.join(', ') %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>


